package com.jeomo.mem.provider.web;

import com.jeomo.common.core.dto.PageQueryDto;
import com.jeomo.common.core.dto.PageResponseDto;
import com.jeomo.common.core.request.PageRequest;
import com.jeomo.common.core.result.CommonResult;
import com.jeomo.common.core.util.BeanCopyUtil;
import com.jeomo.common.core.vo.PageResponseVo;
import com.jeomo.mem.provider.vo.MemberConsumeDetailVo;
import com.jeomo.mem.provider.vo.MemberPointsDetailVo;
import com.jeomo.mem.starter.service.IMemConsumeDetailService;
import com.jeomo.mem.starter.service.IMemPointsDetailService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 会员消费明细
 *
 * @author:Jackpot
 * @create 2020-10-30 15:25
 * @description:
 */
@RestController
@RequestMapping("/member/consume")
public class MemConsumeDetailController {

    @Resource
    private IMemConsumeDetailService memConsumeDetailService;

    @ApiOperation("分页获取会员消费明细")
    @PostMapping("/details")
    public CommonResult<PageResponseVo<MemberConsumeDetailVo>> getPointRulesByPage(@RequestBody PageRequest pageRequest){
        PageQueryDto dto = BeanCopyUtil.copyProperties(pageRequest, PageQueryDto.class);
        PageResponseDto pageResponseDto = memConsumeDetailService.pageSearch(dto);
        PageResponseVo<MemberConsumeDetailVo> memPointsRulePageResVo = BeanCopyUtil.copyPageProperties(pageResponseDto, MemberConsumeDetailVo.class);
        return CommonResult.success(memPointsRulePageResVo);
    }

}
